<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  <head>
    <title>药品管理</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">内容管理</a>
        <a>
          <cite>药品管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
     <!--  <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="/admin/lunboList" method="post" id="listForm">
          <input type="text" name="name"  placeholder="请输入药品名称" autocomplete="off" class="layui-input"> 
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div> -->
      <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加药品','/admin/addLunbo',600,500)"><i class="layui-icon"></i>添加</button>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>轮播图像</th>
            <th>排序</th>
            <th>药品名称</th>
            <th>操作</th></tr>
        </thead>
        <tbody>
        <c:if test="${not empty list}">
      	<c:forEach var="app" items="${list}" varStatus="st">
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
	            </td>
	            <td>${st.index +1}</td>
	            <td><img src="${pageContext.request.contextPath }${app.picUrl}" alt="" width="70" height="50" /></td>
	            <td>${app.picSort}</td>
	            <td>${app.goodsName}</td>
	            <td class="td-manage">
	              <a title="编辑"  onclick="x_admin_show('编辑','/admin/addLunbo?id=${app.id}',600,400)" href="javascript:;">
	                <i class="layui-icon">&#xe642;</i>
	              </a>
	              <a title="删除" onclick="member_del(this,'${app.id}')" href="javascript:;">
	                <i class="layui-icon">&#xe640;</i>
	              </a>
	            </td>
          </tr>
          </c:forEach>
	      </c:if>
        </tbody>
      </table>
   

    </div>
    <script>
      /*用户-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              var url ='/admin/lunboDel?id='+id;
              //$(obj).parents("tr").remove();
              
              $.get(url,function(data){
            	  if('ok'==data){
            		  window.location.reload();
            	  }else{
            		  layer.msg('删除失败!',{icon:1,time:1000});
            	  }
              })
          });
      }
    </script>
    
  </body>

</html>